$(function() {
	if(getCookieValue("token")==""){
		window.location.href = 'l-userlogin.html'
	}
	
	$('#store').on('tap',function(){
		window.location.href = 'v-store.html?business='+CD.geturl().business;
	});
	
	buyerStore(function(data) {
		$('.store-head').html(template('storeHeader', data))
	});
	
	$('.top-one').on('tap',function(){
		window.location.href = 'g-center.html?business='+CD.geturl().business;
	});
	
	$('.buyer-project').on('tap',function(){
		window.location.href = 'v-buyer-order.html?business='+CD.geturl().business;
	});
	
	$('#myPacketTo').on('tap',function(){
		window.location.href = 'm-mypacket.html?business='+CD.geturl().business;
	});
	
	$('#myCollectionTo').on('tap',function(){
		window.location.href = 'v-buyer-collection.html?business='+CD.geturl().business;
	});
})

var buyerStore = function(callback) {
	$.ajax({
		type: "post",
		cache: false,
		traditional: true,
		dataType: "json",
		url: window.address + "/user/findBayUserUuid",
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		data: {
			"userUuid":CD.geturl().business
		},
		success: function(data) {
			console.log(data, 8888);
			callback && callback(data);
		}
	})
}